<?php

class TreeTest extends CActiveRecord {

    

    /**
     * The followings are the available columns in table 'www_trees':
     * @var integer $id
     * @var string $name
     * @var integer $left_value
     * @var integer $right_value
     * @var integer $level
     */

    /**
     * Returns the static model of the specified AR class.
     * @return CActiveRecord the static model class
     */
    public static function model($className=__CLASS__) {
        return parent::model($className);
    }

//    public function behaviors() {
//        return array(
//            'TreeBehavior' => array(
//                'class' => 'application.extensions.nestedset.TreeBehavior',
//                '_idCol' => 'id',
//                '_lftCol' => 'left_value',
//                '_rgtCol' => 'right_value',
//                '_lvlCol' => 'level',
//            )
//        );
//    }

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return '{{trees}}';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules() {
    // NOTE: you should only define rules for those attributes that
    // will receive user inputs.
        return array(
        array('name', 'required'),
        array('left_value, right_value, level', 'numerical', 'integerOnly'=>true),
        array('name', 'length', 'max'=>200),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations() {
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
        return array(
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
        'id' => 'Id',
        'name' => 'Name',
        'left_value' => 'Left Value',
        'right_value' => 'Right Value',
        'level' => 'Level',
        );
    }
}